package com.pm.service.log.impl;

import com.pm.entity.po.log.LightLog;
import com.pm.mapper.log.LightLogMapper;
import com.pm.service.impl.BaseServiceImpl;
import com.pm.service.log.LightLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LightLogServiceImpl extends BaseServiceImpl<LightLog> implements LightLogService {
    @Autowired
    LightLogMapper lightLogMapper;
    @Override
    public Integer lightLogAdd(LightLog lightLog) {
        lightLog.setRead(0);
        return lightLogMapper.lightLogAdd(lightLog);
    }

    @Override
    public List<LightLog> getLightLogList(LightLog lightLog) {
        List<LightLog> lightLogs = lightLogMapper.getLightLogList(lightLog);
        for (LightLog l:
                lightLogs) {
            l.setStatus(-1);
        }
        return lightLogs;
    }

    @Override
    public Integer updateReda(LightLog lightLog) {
        lightLog.setRead(1);
        return lightLogMapper.updateReda(lightLog);
    }
}
